using System;

namespace WCSFContrib.Extensions.CompositeWeb
{
    /// <summary>
    /// Declares that the field value should be get from the QueryString.
    /// </summary>
    [AttributeUsage(AttributeTargets.Field, Inherited = false, AllowMultiple = false)]
    public sealed class QueryStringKeyAttribute : Attribute
    {
        private readonly string _queryStringKeyName;

        /// <summary>
        /// Initializes a new instance of <see cref="QueryStringKeyAttribute"/>
        /// </summary>
        /// <param name="queryStringKeyName">The name of the key to use to retrieve the field value from the QueryString.</param>
        public QueryStringKeyAttribute(string queryStringKeyName)
        {
            this._queryStringKeyName = queryStringKeyName;
        }

        /// <summary>
        /// Gets the name of the key to use to retrieve the field value in the QueryString.
        /// </summary>
        public string QueryStringKeyName
        {
            get
            {
                return this._queryStringKeyName;
            }
        }
    }
}